package com.yalemang.photovalut.ui.preview

import com.yalemang.framework.base.BaseActivity
import com.yalemang.photovalut.base.ext.gone
import com.yalemang.photovalut.databinding.ActivityPreviewPhotoBinding
import com.yalemang.photovalut.res.R
import com.yalemang.photovalut.ui.choice.ChoicePhotoActivity

class PreviewPhotoActivity: BaseActivity<ActivityPreviewPhotoBinding, PreviewPhotoPresenter>(),
    PreviewPhotoContract.PreviewPhotoView {

    private lateinit var photoPaths: ArrayList<String>

    override fun initData() {
        photoPaths = intent.getStringArrayListExtra(ChoicePhotoActivity.KEY_PHOTO_PATH_LIST)!!
    }

    override fun onRestart() {
        super.onRestart()
    }

    override fun initView() {
        mBinding.tbPreviewPhoto.setBackgroundResource(R.color.black)
        mBinding.tbPreviewPhoto.tvLeft.gone()
        mBinding.tbPreviewPhoto.tvRight.gone()
        mBinding.tbPreviewPhoto.ivCenter.gone()
        mBinding.tbPreviewPhoto.ivLeft.setImageResource(R.drawable.ic_back)
        mBinding.tbPreviewPhoto.ivRight.setImageResource(R.drawable.ic_check_no)

        mBinding.vpPreviewPhoto.adapter =
            com.yalemang.photovalut.ui.preview.adapter.PreviewFragmentAdapter(this, photoPaths)
    }

    override fun initMVP() {
        mPresenter = PreviewPhotoPresenter()
        mPresenter.mView = this
        mPresenter.mModel = PreviewPhotoModel()
    }
}